<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>new (ServerMonitor::Server)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File ServerMonitor.rb, line 20</span>
                <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">opts</span>={})
                        <span class="ruby-identifier">options</span> = {<span class="ruby-identifier">:ports</span> =<span class="ruby-operator">&gt;</span> [], <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">:urls</span> =<span class="ruby-operator">&gt;</span> [], <span class="ruby-identifier">:domain</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;&quot;</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>)
                        <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ports</span>].<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:name</span>].<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:urls</span>].<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:domain</span>].<span class="ruby-identifier">empty?</span>) 
                                <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Invalid Server Options&quot;</span> 
                        <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">opts</span> <span class="ruby-operator">==</span> {} <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Hash</span>

                        <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:name</span>]
                        <span class="ruby-ivar">@domain</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:domain</span>]
                        <span class="ruby-identifier">urls</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:urls</span>]
                        <span class="ruby-ivar">@urls</span> = []
                        <span class="ruby-identifier">urls</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span>
                                <span class="ruby-identifier">add_url</span>(<span class="ruby-identifier">url</span>)
                        <span class="ruby-keyword kw">end</span>
                        <span class="ruby-identifier">ports</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ports</span>]
                        <span class="ruby-ivar">@ports</span> = []
                        <span class="ruby-identifier">ports</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">port</span><span class="ruby-operator">|</span>
                                <span class="ruby-identifier">add_port</span>(<span class="ruby-identifier">port</span>)
                        <span class="ruby-keyword kw">end</span>
                <span class="ruby-keyword kw">end</span></pre>
</body>
</html>